// import { config } from '../../config/index';
import { api } from '../../config/api';
import { request } from '../../utils/request';

/** 获取活动列表 */
function mockFetchActivityList(pageIndex = 1, pageSize = 20) {
  const { delay } = require('../_utils/delay');
  const { getActivityList } = require('../../model/activities');

  return delay().then(() => getActivityList(pageIndex, pageSize));
}

/** 获取活动列表 */
export function fetchActivityList(pageIndex = 1, pageSize = 20, spuId = '') {
  // if (config.useMock) {
  //   return mockFetchActivityList(pageIndex, pageSize);
  // }
  return request.get(api.promotion.list, {pageIndex, pageSize, spuId})
}
